home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / midipeek.zip / MINIPEEK.PAS < prev    next >
Pascal/Delphi Source File  |  1988-09-04  |  1KB  |  40 lines

  1. { Copyright 1988 Carter Scholz }
  2.  
  3. Uses
  4.   Crt, Mpu;
  5.  
  6. var
  7.   done:boolean;
  8.   MidiData: byte;
  9.  
  10. function Hex(b:byte):string;
  11.   const
  12.     hx : array [0..15] of char = '0123456789ABCDEF';
  13.   begin
  14.     Hex := hx [b shr 4] + hx [b and 15];
  15.   end;
  16.  
  17. { **** MAIN PROGRAM **** }
  18.  
  19. begin
  20.   done:=false;
  21.   resetMPU;
  22.   PutCmd ($3F);                          { Put MPU into UART mode. }
  23.   gotoxy(1,25);
  24.   write ('Now peeking ... Press any key to quit');
  25.   window(1,1,80,24);
  26.   clrscr;
  27.   repeat                                 { Begin loop. }
  28.     GetData (MidiData);                  { Get MIDI data from MPU.}
  29.     if (MidiData <> $FE)                 { If it's not an active-sensing byte...}
  30.       then begin
  31.         if mididata>=$80 then HighVideo else LowVideo;
  32.         write ( Hex (MidiData),'  ');    { ...  write it to the screen.     }
  33.       end;
  34.   until keypressed;                            { Repeat till keypressed. }
  35.   resetMPU;
  36.   window(1,1,80,25);
  37.   clrscr;
  38.   writeln ('MPU reset.  So long!');
  39. end.
  40.